//
//  LocalDetailViewController.m
//  LocalTest
//
//  Created by Pibinuo on 15/12/4.
//  Copyright © 2015年 皮比诺. All rights reserved.
//

#import "LocalDetailViewController.h"
#import "LocalHelper.h"


@interface LocalDetailViewController ()<UIWebViewDelegate,UIScrollViewDelegate>

@property(nonatomic,strong)UIWebView * webView;

@end

@implementation LocalDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initWithWeb];
}

-(void)initWithWeb
{
    News * new = [[LocalHelpers defaultHelpers] modelWithIndex:self.index];
    self.webView = [[UIWebView alloc]init];
    if ([new.type isEqualToString:@"doc"]) {
        self.webView.frame = CGRectMake(0, - 50, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame) + 500);
    }else{
        self.webView.frame = CGRectMake(0, - 50, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame) + 50);
    }
    self.webView.scrollView.bounces = NO;
    [self.view addSubview:self.webView];
    self.webView.delegate =self;
    self.webView.scalesPageToFit = YES;
    NSURL * url = [NSURL URLWithString:new.commentsUrl];
    NSURLRequest * request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
